/*
-----------------------------------------------------------------------------
This source file is part of Labor3D
(Labor 3D Graphics Engine)

Copyright (c) 2009-2020 Rock Mao
* creator : Rock Mao
* created : 2009-5-3   22:29
* filename: LaborMatrix4Function.cpp
-----------------------------------------------------------------------------
*/
#include "stdafx.h"

#include "LaborMatrix4Function.h"

NAMESPACE_LABOR3D_BEGIN

void LABORCORE_API  LM_Mul(const CLMatrix4x4& mat, CLPoint4& ptIn)
{
	ptIn.x = ptIn.x * mat.m[0][0] + ptIn.y * mat.m[1][0] + ptIn.z * mat.m[2][0] + ptIn.w * mat.m[3][0];
	ptIn.y = ptIn.x * mat.m[0][1] + ptIn.y * mat.m[1][1] + ptIn.z * mat.m[2][1] + ptIn.w * mat.m[3][1];
	ptIn.z = ptIn.x * mat.m[0][2] + ptIn.y * mat.m[1][2] + ptIn.z * mat.m[2][2] + ptIn.w * mat.m[3][2];
	ptIn.w = ptIn.x * mat.m[0][3] + ptIn.y * mat.m[1][3] + ptIn.z * mat.m[2][3] + ptIn.w * mat.m[3][3];
}

void LABORCORE_API  LM_Mul(const CLMatrix4x4& mat, const CLPoint4& ptIn, CLPoint4& ptOut)
{
	ptOut.x = ptIn.x * mat.m[0][0] + ptIn.y * mat.m[1][0] + ptIn.z * mat.m[2][0] + ptIn.w * mat.m[3][0];
	ptOut.y = ptIn.x * mat.m[0][1] + ptIn.y * mat.m[1][1] + ptIn.z * mat.m[2][1] + ptIn.w * mat.m[3][1];
	ptOut.z = ptIn.x * mat.m[0][2] + ptIn.y * mat.m[1][2] + ptIn.z * mat.m[2][2] + ptIn.w * mat.m[3][2];
	ptOut.w = ptIn.x * mat.m[0][3] + ptIn.y * mat.m[1][3] + ptIn.z * mat.m[2][3] + ptIn.w * mat.m[3][3];
}

void LABORCORE_API  LM_Mul(const CLMatrix4x4& mat, CLPoint3& ptIn)
{
	ptIn.x = ptIn.x * mat.m[0][0] + ptIn.y * mat.m[1][0] + ptIn.z * mat.m[2][0] ;
	ptIn.y = ptIn.x * mat.m[0][1] + ptIn.y * mat.m[1][1] + ptIn.z * mat.m[2][1] ;
	ptIn.z = ptIn.x * mat.m[0][2] + ptIn.y * mat.m[1][2] + ptIn.z * mat.m[2][2] ;
}


void LABORCORE_API  LM_Mul(const CLMatrix4x4& mat, const CLPoint3& ptIn, CLPoint3& ptOut)
{
	ptOut.x = ptIn.x * mat.m[0][0] + ptIn.y * mat.m[1][0] + ptIn.z * mat.m[2][0] ;
	ptOut.y = ptIn.x * mat.m[0][1] + ptIn.y * mat.m[1][1] + ptIn.z * mat.m[2][1] ;
	ptOut.z = ptIn.x * mat.m[0][2] + ptIn.y * mat.m[1][2] + ptIn.z * mat.m[2][2] ;
}



NAMESPACE_LABOR3D_END

